# Maintainer: Johannes Löthberg <johannes@kyriasis.com>
# Contributor: Federico Cinelli <cinelli@aur.archlinux.org>

pkgname=nss-pam-ldapd
pkgver=0.9.12
pkgrel=3

pkgdesc='LDAP module for NSS and PAM'
url="https://arthurdejong.org/nss-pam-ldapd/"
arch=('loong64' 'x86_64')
license=('LGPL2.1')

depends=('pam' 'python')
conflicts=('pam_ldap')

provides=('nslcd')

backup=('etc/nslcd.conf')

options=('!emptydirs')


source=("https://arthurdejong.org/nss-pam-ldapd/nss-pam-ldapd-$pkgver.tar.gz"{,.sig}
        "nslcd.service"
        "nslcd.sysusers"
        "nslcd.tmpfiles")

sha512sums=('5eca4851a9bcb2779548d193a363a143d6106bfc6463b8d3f0c2d5d7d227ec1e680861383d4813f40b44d1be2ce5f7ed019d838f7f6796e15f96f7411d3bb8f6'
            'SKIP'
            '19d8bd23b5fe7f83979724cb579f23991bc4049d3c5caaa6ae64444ff7aa7d13226e39de6321f0425781cf013db7370b6841a396c2274af262b9fd3255ea2aa0'
            'c419c9e47c428db9354ca4b2abacdcf3b93a7d4a31f57fb838ffe85262eaf24177f1d28a7a44b14a7815058a75697ffe282bc76054d4c2089d442ec0f4b48d9e'
            'ccffd327cfa015ec746f4e1506c02beb514763625b0e5818455491b911d9328b19f17620926c15aaf18f5cd9268ea71f5ef35ce7a427aefab950579d5629ee5d')

validpgpkeys=('452EC2CB65CF68C2A1ADBF5F2A8B746810E0AFC1')

prepare() {
  cd nss-pam-ldapd-$pkgver

  autoreconf -fi
  ./configure \
    --prefix=/usr \
    --sbindir=/usr/bin \
    --sysconfdir=/etc \
    --localstatedir=/var \
    --with-pam-seclib-dir=/usr/lib/security \
    CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS"
}

build() {
  cd nss-pam-ldapd-$pkgver
  make
}

check() {
  cd nss-pam-ldapd-$pkgver
  make check
}

package() {
  cd nss-pam-ldapd-$pkgver

  install -Dm644 "$srcdir/nslcd.sysusers" "$pkgdir/usr/lib/sysusers.d/nslcd.conf"
  install -Dm644 "$srcdir/nslcd.tmpfiles" "$pkgdir/usr/lib/tmpfiles.d/nslcd.conf"
  install -Dm644 "$srcdir/nslcd.service" "$pkgdir/usr/lib/systemd/system/nslcd.service"
  install -Dm644 "$srcdir/$pkgname-$pkgver/nslcd.conf" "$pkgdir/etc/nslcd.conf"

  make DESTDIR="$pkgdir" install
}

# vim:set ts=2 sw=2 et:
